package com.aidex.biz.service.impl;

import com.aidex.biz.domain.GongziSetting;
import com.aidex.biz.mapper.GongziSettingMapper;
import com.aidex.biz.service.GongziSettingService;
import com.aidex.common.annotation.DataScope;
import com.aidex.common.core.service.BaseServiceImpl;
import com.aidex.common.utils.NumberUtils;
import com.github.pagehelper.PageInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 工资规则Service业务层处理
 * @author sean
 * @email 2074844820@qq.com
 * @date 2024-01-30
 */
@Service
@Transactional(readOnly = true)
public class GongziSettingServiceImpl extends BaseServiceImpl<GongziSettingMapper, GongziSetting> implements GongziSettingService
{
    private static final Logger log = LoggerFactory.getLogger(GongziSettingServiceImpl.class);

    /**
     * 获取单条数据
     * @param gongziSetting 工资规则
     * @return 工资规则
     */
    @Override
    public GongziSetting get(GongziSetting gongziSetting)
    {
        GongziSetting dto = super.get(gongziSetting);
        return dto;
    }

    /**
     * 获取单条数据
     * @param id 工资规则id
     * @return 工资规则
     */
    @Override
    public GongziSetting get(String id)
    {
        GongziSetting dto = super.get(id);
        return dto;
    }


    /**
     * 查询工资规则列表
     * @param gongziSetting 工资规则
     * @return 工资规则
     */
    @Override
    @DataScope(userAlias = "a",deptAlias = "a")
    public List<GongziSetting> findList(GongziSetting gongziSetting)
    {
        return super.findList(gongziSetting);
    }

    /**
     * 分页查询工资规则列表
     * @param gongziSetting 工资规则
     * @return 工资规则
     */
    @Override
    @DataScope(userAlias = "a",deptAlias = "a")
    public PageInfo<GongziSetting> findPage(GongziSetting gongziSetting)
    {
        return super.findPage(gongziSetting);
    }

    /**
     * 保存工资规则
     * @param gongziSetting
     * @return 结果
     */
    @Override
    public boolean save(GongziSetting gongziSetting)
    {
        return super.save(gongziSetting);
    }


    /**
     * 删除工资规则信息
     * @param gongziSetting
     * @return 结果
     */
    @Override
    public boolean remove(GongziSetting gongziSetting)
    {
        return super.remove(gongziSetting);
    }

    /**
     * 批量删除工资规则
     * @param ids 需要删除的工资规则ID
     * @return 结果
     */
    @Transactional(readOnly = false)
    @Override
    public int deleteGongziSettingByIds(String[] ids)
    {
        return mapper.deleteGongziSettingByIds(ids);
    }

    /**
     * 获取最大编号
     * @param gongziSetting 工资规则
     * @return 结果
     */
    @Override
    public int findMaxSort(GongziSetting gongziSetting)
    {
        return NumberUtils.nextOrder(mapper.findMaxSort(gongziSetting));
    }
}
